package de.tum.in.eist.poll.shared.beans;


/**
 * A StudentLectureKey object is a tuple of a Student ID and a Lecture ID 
 * used as key for {@link Map}s. Using it ensures, that a Student may never
 * comment more than once on one lecture.
 *  
 * @author The EIST-POLL-21 team.
 *
 */
public class StudentLectureKey /*implements Comparable<StudentLectureKey>*/ {
	private String studentID;
	private String lectureID;
	
	public StudentLectureKey(String studentID, String lectureID) {
		this.studentID = studentID;
		this.lectureID = lectureID;
	}
	
	public String getStudentID() {
		return studentID;
	}
	
	public String getLectureID() {
		return lectureID;
	}
//	
//	@Override
//	public int compareTo(StudentLectureKey other) {
//		if (studentID == other.studentID)
//			return lectureID.compareTo(other.lectureID);
//		
//		return studentID.compareTo(other.studentID);
//	}
	
	@Override
	public boolean equals(Object other) {
		if (other instanceof StudentLectureKey) {
			StudentLectureKey otherkey = (StudentLectureKey)other;
			return studentID == otherkey.studentID && lectureID == otherkey.lectureID;
		}
		return false;		
	}
	
	@Override
	public int hashCode() {
		return studentID.hashCode() + lectureID.hashCode();
	}
}